package com.example.demo.serrivice;

import com.example.demo.dao.TbUserDAO;
import com.example.demo.entity.TbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TbUserServicelmpl implements TbUserService {
    @Autowired
    private TbUserDAO tbUserDAO;
    @Override
    public List<TbUser> findAll(){

        return  tbUserDAO.findAll();
    }
    @Override
    public  String add(TbUser user){
        int status = tbUserDAO.add(user);
        if(status>0){
            return "1";
        }
        else{
            return "0";
        }
    }

    @Override
    public String updateUser(TbUser user) {
        int status = tbUserDAO.updateUser(user);
        if(status>0){
            return "1";
        }
        else{
            return "0";
        }
    }

    @Override
    public String deldate(int id) {
        int status = tbUserDAO.delUser(id);
        if(status>0){
            return "1";
        }
        else{
            return "0";
        }
    }
}
